<admintpl file="header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>订单综合统计<span>【以下数据统计日期截止到昨天】</span></a></li>
    </ul>
    <form class="well form-search" method="post" action="{:U('Report/report_orders')}">
        用户名&nbsp;&nbsp;<input type="text" name="username" style="width: 200px;" value="{:I('request.username')}" placeholder="请输入用户名" />
        身份证&nbsp;&nbsp;<input type="text" name="identity" style="width: 200px;" value="{:I('request.identity')}" placeholder="请输入身份证" />
        手机&nbsp;&nbsp;<input type="text" name="mobile" style="width: 200px;" value="{:I('request.mobile')}" placeholder="请输入手机" />
        订单号&nbsp;&nbsp;<input type="text" name="order_no" style="width: 200px;" value="{:I('request.order_no')}" placeholder="请输入订单号" />
        订单状态&nbsp;&nbsp;
        <php>$statusModel = new \User\Model\ReportCurrentOrders()</php>
        <php>$statusList = $statusModel->getStatusText(0,true);</php>
        <select name="status">
            <option value="">全部</option>
            <volist name="statusList" id="v">
                <option value="{$key}">{$v}</option>
            </volist>
        </select><br/><br />
        <script>
            $(function(){
                $('select[name="status"]').find('option[value=\'{:I("request.status")}\']').prop('selected',true);
            })
        </script>
        申请日期&nbsp;&nbsp;<input class="js-date" type="text" name="starts" style="width: 150px;" value="{:I('request.starts')}" placeholder="起始时间">
        <input class="js-date" type="text" name="ends" style="width: 150px;" value="{:I('request.ends')}" placeholder="结束时间">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="">清空</a>
    </form>
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>订单号</th>
                <th>用户姓名</th>
                <th>手机</th>
                <th>身份证号</th>
                <th>订单状态</th>
                <th>借款金额</th>
                <th>申请时间</th>
                <th>逾期M状态</th>
                <th>累计已还款金额</th>
                <th>累计续期次数</th>
                <th>累计续期金额</th>
                <th>累计逾期次数</th>
                <th>累计逾期金额</th>
                <th>累计逾期天数</th>
                <th>累计逾期期数</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="list" item="vo">
                <tr>
                    <td>{$vo.order_no}</td>
                    <td>{$vo.name}</td>
                    <td>{$vo.mobile}</td>
                    <td>{$vo.identity}</td>
                    <td>{$statusModel->getStatusText($vo['status'])}</td>
                    <td>{$vo.amount}</td>
                    <td>{$vo.crtime}</td>
                    <td><php>echo User\Model\ReportOrders::get_overdue_m_status_text($vo['overdue_m_status'])</php></td>
                    <td>{$vo.has_paid}</td>
                    <td>{$vo.xu_count}</td>
                    <td>{$vo.xu_amount}</td>
                    <td>{$vo.yu_count}</td>
                    <td>{$vo.yu_amount}</td>
                    <td>{$vo.yu_days}</td>
                    <td>{$vo.yu_period}</td>
                </tr>
            </foreach>
            </tbody>
            <tfoot>
            <tr>
                <td>当页合计：</td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
            </tr>
            </tfoot>
        </table>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    $(function () {
        var arr = [5,8,9,10,11,12,13,14];//要取哪几列的合计
        var def = 'var ';
        for(var a in arr){
            def += ('total'+arr[a]+'=0,');
        }
        def=def.substring(0,def.length-1)+';';
        eval(def);//执行定义
        $('tbody tr').each(function() {
            for(var i in arr){
                $(this).find('td:eq('+arr[i]+')').each(function(){
                    var tmp = $(this).text();
                    if(tmp === ''){
                        tmp = 0;
                    }
                    eval('total'+arr[i]+'+=parseFloat(tmp);');
                });
            }
        });
        for(var x in arr){
            $('tfoot tr:eq(0)').find('td:eq('+arr[x]+')').text(eval('total'+arr[x]));
        }
    });
</script>
</body>
</html>